package edu.sandau.b23015103.b23015103.service;

import edu.sandau.b23015103.b23015103.mode.Hobby;
import edu.sandau.b23015103.b23015103.repository.HobbyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

@Component
public class HobbyService {
    @Autowired
    private HobbyRepository hobbyRepository;
    public Object finAll(Hobby hobby)
    {
        return hobbyRepository.findAll(Example.of(hobby));
    }

    public void deleteById(String id){
        hobbyRepository.deleteById(id);
    }

    public void save(Hobby s){
        hobbyRepository.save(s);
    }

    public Hobby getReferenceById(String id){
        return hobbyRepository.getReferenceById(id);
    }

}
